<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>正则扩展-正则断言</title>
</head>

<body>
  <script>
    // 声明字符串
    let str = "JS5211314你知道么555啦啦啦";

    // 正向断言
    /* const reg = /\d+(?=啦)/;
    const result = reg.exec(str);

    console.log(result); */

    // 反向断言
    const reg = /(?<=么)\d+/;
    const result = reg.exec(str);

    console.log(result);
  </script>
</body>

</html>